from appium.webdriver.common.appiumby import AppiumBy

from basic.basepage import BasePage
from page.page_features_goods_details import PageGoodsDetails


class PageNewProduct(BasePage):
    def goto_goods_details(self):
        locator = (AppiumBy.XPATH, '//android.widget.FrameLayout[@resource-id="com.xiaomi.shop:id/layout_root"]/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup[1]/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup')
        self.click(locator,5)
        locator = (AppiumBy.XPATH, '//android.widget.HorizontalScrollView/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup/android.view.ViewGroup/android.widget.ImageView[2]')
        self.click(locator,5)
        locator = (AppiumBy.XPATH,'//android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup[3]/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[1]')
        self.click(locator,5)
        locator = (AppiumBy.XPATH,'(//android.view.ViewGroup[@resource-id="com.xiaomi.shop:id/content_container"])[1]')
        self.click(locator,5)
        return PageGoodsDetails()